<template>
	<view>
		<cu-custom bgColor="bg-gradual-blue" :isBack="true">
			<block slot="content">我接的任务</block>
		</cu-custom>
		<!-- 加载动画 -->
		<view v-if="pageLoad" class="text-gray padding justify-center flex align-center">
			<u-loading mode="circle" color="#2979ff" size="40"></u-loading>
			<view class="margin-left-sm">加载中...</view>
		</view>
		<view v-if="!pageLoad">
			<view class="text-gray padding justify-center flex" v-if="Object.keys(list).length === 0" ><text>暂无数据</text></view>	
						
			<view class="cu-card case isCard">
				<view class="cu-item shadow" v-for="(item,index) in list" :key="index" @click="goDetail(item._id)">
					<view class="text-content padding-sm text-cut" style="width:100%;">
						<view>取件地址：{{item.address}}</view>
						<view>送货时间：{{item.time}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	 
	export default {
		data() {
			return {
				list: [],
				pageLoad: true,
				userid: this.$store.getters.userInfo._id
			}
		},
		onLoad:function(){
			this.getPage()
		},
		onPullDownRefresh:function(){			 
			this.getPage()
		},
		methods: {
			goDetail:function(id){
				uni.navigateTo({
					url:"/pages/user/mypublish/detail?id="+id
				})
			}, 
			getPage:function(){
				var that = this
				that.pageLoad = true
				uniCloud.callFunction({
					name:"getMyAccept",
					data:{
						userid: this.userid,
					}
				}).then((result)=>{
					console.log(result);
					var res = result.result.data
					that.list = res
					that.pageLoad = false
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
 
</style>
